package com.model.demo.designmodel.observer.event;


import com.model.demo.designmodel.observer.event.mouseevent.Mouse;
import com.model.demo.designmodel.observer.event.mouseevent.MouseEventCallback;
import com.model.demo.designmodel.observer.event.mouseevent.MouseEventType;

/**
 * Created by Tom on 2019/3/17.
 */
public class MouseEventTest {
    public static void main(String[] args) {

        MouseEventCallback callback = new MouseEventCallback();

        Mouse mouse = new Mouse();

        //@谁？  @回调方法
        //先添加监听器（观察者），注册事件
        mouse.addLisenter(MouseEventType.ON_CLICK, callback);
        //触发事件
        mouse.click();
        mouse.addLisenter(MouseEventType.ON_FOCUS,callback);


        mouse.focus();


    }
}
